package org.huawei260.TiKu.ODsuanfa;

import java.util.Arrays;
import java.util.Scanner;
import java.util.StringJoiner;
public class A_2023A_3302__二分查找_开放日活动 {

//	public class Main {
		public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);

			int sum = sc.nextInt();
			int n = sc.nextInt();

			Integer[] arr = new Integer[n];
			for (int i = 0; i < n; i++) {
				arr[i] = sc.nextInt();
			}

			System.out.println(getResult(sum, arr, n));
		}

		public static String getResult(int sum, Integer[] arr, int n) {
			long total = 0;
			int max_maxCapacity = 0;
			for (int i = 0; i < n; i++) {
				max_maxCapacity = Math.max(max_maxCapacity, arr[i]);
				total += arr[i];
			}

			if (total <= sum) return "[]";

			int min_maxCapacity = sum / n;

			final int min_maxCapacity_copy = min_maxCapacity;
			Integer[] ans =
				Arrays.stream(arr)
					.map(count -> count > min_maxCapacity_copy ? count - min_maxCapacity_copy : 0)
					.toArray(Integer[]::new);

			while (max_maxCapacity - min_maxCapacity > 1) {
				int maxCapacity = (max_maxCapacity + min_maxCapacity) / 2;

				// tmp数组保存的是每个桶移除的球的数量
				Integer[] tmp = new Integer[n];
				long remain = total;
				for (int i = 0; i < arr.length; i++) {
					// r是每个桶需要移除的球的个数，如果桶内球数超过maxCapacity，则需要移除超出部分，否则不需要移除
					int r = arr[i] > maxCapacity ? arr[i] - maxCapacity : 0;
					remain -= r;
					tmp[i] = r;
				}

				if (remain > sum) {
					max_maxCapacity = maxCapacity;
				} else if (remain < sum) {
					min_maxCapacity = maxCapacity;
					ans = tmp;
				} else {
					ans = tmp;
					break;
				}
			}

			StringJoiner sj = new StringJoiner(",", "[", "]");
			for (Integer an : ans) {
				sj.add(an + "");
			}

			return sj.toString();
		}
	}